//
//  PlatformIntroductionViewController.m
//  yonghu
//
//  Created by 浪尖渝力 on 2018/2/7.
//  Copyright © 2018年 com.DJS. All rights reserved.
//

#import "PlatformIntroductionViewController.h"
#import "PlatformIntroductionTableViewCell.h"
#import "LawyerListViewController.h"
#import "ExpertListViewController.h"
@interface PlatformIntroductionViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)NSNumber *num;
@end

@implementation PlatformIntroductionViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title=@"平台介绍";
    _num=@1;
    BaseTableView *tabelView=[BaseTableView new];
    [self.view addSubview:tabelView];
    [tabelView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.mas_equalTo(0);
        make.top.mas_equalTo(64);
    }];
    tabelView.backgroundColor=_LightGrey;
    tabelView.delegate=self;
    tabelView.dataSource=self;
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    PlatformIntroductionTableViewCell *cell=[[PlatformIntroductionTableViewCell alloc] init];
    if (indexPath.row==0) {
        cell.num=_num;
        [cell setFrame:CGRectMake(0, 0, _mainW, [cell creatView])];
        __weak typeof(self) weakSelf = self;
        cell.customSelectedBlock = ^ (NSNumber *abc)
        {
            _num=abc;
            NSIndexPath *indexPath=[NSIndexPath indexPathForRow:0 inSection:0];
            [tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
     
        };
    }
    if (indexPath.row==1){
        [cell creatView2];
    }if (indexPath.row==2){
        [cell creatView3];
    }
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row==0) {
        UITableViewCell *cell;
        cell= [self tableView:tableView cellForRowAtIndexPath:indexPath];
        return cell.frame.size.height;
    }
    return _mainW*0.35+30;
}


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row==1) {
        LawyerListViewController *laye=[[LawyerListViewController alloc] init];
        [ZQTools pushNextViewController:self andRootController:laye];
    }  if (indexPath.row==2) {
        ExpertListViewController *laye=[[ExpertListViewController alloc] init];
        [ZQTools pushNextViewController:self andRootController:laye];
    }
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
